package com.ag.lzm.test;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.junit.Test;

import com.ag.bean.TbPropose;
import com.ag.common.AnnexPath;
import com.ag.common.EventUtil;
import com.ag.lzm.dao.BaseDAO;
import com.ag.lzm.dao.TbUriDAO;
import com.ag.lzm.utils.PlanUtils;
import com.ag.work2.action.ReportAction;
import com.ag.work2.service.IReportService;
import com.ag.wzp.action.EventBase;

public class YYYTYe extends BaseTest {
	private static final Logger logger = Logger.getLogger(EventBase.class);
//	@Resource(name = "LZMReportServiceImpl")
//	private IReportService reportService;
//	@Resource(name = "LZMReportAction")
//	private ReportAction report;
	@Resource(name = "LZMReportServiceImpl")
	private IReportService reportService;
	@Resource(name = "LZMBaseDAO")
	private BaseDAO baseDAO;
	
	@Resource(name = "LZMTbUriDAO")
	private TbUriDAO uriDAO;

	@Test
	public void getDAByEId() {
//		String fileUL = uriDAO.findById(AnnexPath.PLAN_ANNEX_PATH).getUPath();
//		System.out.println(fileUL==null);
//		//logger.info("do get DAByEId");
		String EId = "1010112031";
//		
//		String UId ="yjbzr";
		Object[] obj = { EId ,EId};
//		try {
//			
//			String queryString = "select count(*) from TbPlan p join p.tbPlanGrade pg where "
//				+ "pg.pgDetail = (select el.c from TbEvent e join e.tbEventLevel el where e.EId = ?))";
			//String queryString="from TbPlan p join fetch p.tbPlanGrade ppg where ppg.pgDetail = (select el.c from TbEvent e join e.tbEventLevel el where e.EId = ?)";
//		String queryString = "select count(p.PId) from TbPlan p join p.tbEventType pe join p.tbPlanGrade pg where "
//			+ "pe.etId = (select ee.etId from TbEvent e join e.tbEventType ee where e.EId = ?) and pg.pgDetail = (select el.c from TbEvent e join e.tbEventLevel el where e.EId = ?)";	
		String queryString = "select count(*) from TbPlan p join p.tbEventType pe join p.tbPlanGrade pg where "
			+ "pe.etId = (select ee.etId from TbEvent e join e.tbEventType ee where e.EId = ?) and pg.pgDetail = (select el.c from TbEvent e join e.tbEventLevel el where e.EId = ?) and p.b = "+PlanUtils.RELEASE;
		List list=baseDAO.find(queryString,obj);
			System.out.println(list==null);
			System.out.println(list.size());
			System.out.println(list.get(0));
//			
//			Object[] objects={"1010082234","1010082234"};
//			String queryString = "select count(*) from TbPlan p join p.tbEventType pe join p.tbPlanGrade pg where "
//				+ "pe.etId = (select ee.etId from TbEvent e join e.tbEventType ee where e.EId = ?) and pg.pgDetail = (select el.c from TbEvent e join e.tbEventLevel el where e.EId = ?)";
//			
//			
//			//System.out.println();
//			Long logng=(Long)baseDAO.find(queryString,objects).get(0);
//			//Long logng=(Long)baseDAO.find(queryString,"1010082234").get(0);
//			System.out.println(logng);
////			String que3 = "select count(*) from TbProposeRecord pr join pr.tbPropose pp join pp.tbEvent et where et.EId = ? and pr.tbUserByPrCheckId.UId = ? and pr.c = '1'";
////			//select count(*) from TbProposeRecord pr join pr.tbPropose pp join pp.tbEvent et where et.EId = ? and pr.tbUserByPrCheckId.UId = ? and pr.c = '2'
////			//String s="select distinct count(pr.newPpId) from TbProposeRecord pr join pr.tbPropose pp where pr.tbUserByPrCheckId.UId = 'yjbzr' and pp.tbEvent.EId = '1010072216'";
////			//List list=baseDAO.find(s,obj);
////			List list=baseDAO.find(que3,obj);
////			System.out.println((Long)list.get(0));
////			System.out.println("dsfdsfds");
//////			String p = reportService.selectExt4Command(EId);
//////			System.out.println(p);
//////			System.out.println(p==null);
//		report.setEId(EId);
//		report.findEventPropose();
		//TbPropose p = reportService.findEventPropose(EId);
		//logger.info("ggodd");
		//System.out.println(p==null);
		//System.out.println(p.getTbEvent().getEId());
		//logger.info("das.size()"+das.isEmpty());
		//System.out.println(das.size());
		//logger.info("das.size()"+das.size());
	}

}
